import cgi
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django', '1.1')

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

from apis.auth import AuthHandler
from apis.referer import RefererHandler

from apis.tierlist import GetTierListHandler
from apis.instancetier import GetInstanceTierHandler

class APIHandler(webapp.RequestHandler):
  def get(self, direction):
    pass

def main():
  application = webapp.WSGIApplication(
                                        # Auth based handlers
                                        [('/apis/auth/(\w+)', AuthHandler),
                                        ('/apis/referer/(.+)', RefererHandler),

                                        # Public APIs.
                                        ('/apis/tierlist/?', GetTierListHandler),
                                        ('/apis/tierlist/(.+)?', GetTierListHandler),
                                        ('/apis/instancetier/(.+)', GetInstanceTierHandler)],
                                        debug=True)
  
  run_wsgi_app(application)


if __name__ == '__main__':
  main()